cmake_minimum_required(VERSION 3.22)

project(Qt-PromotedWidget LANGUAGES CXX)

file(GENERATE OUTPUT ${CMAKE_SOURCE_DIR}/.gitignore CONTENT "
.idea
cmake-build-*
CMakeLists.txt.user
build
.gitignore
")

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_program(GIT_EXE git)
if (NOT GIT_EXE)
    message("git Not found!")
    return()
endif ()
message("${GIT_EXE}")

if (NOT WIN32)
    message("It's not Windows!")
    return()
endif ()

# 获取当前目录下的所有文件夹
file(GLOB subdirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/../ "${CMAKE_CURRENT_SOURCE_DIR}/../*/")

# 消除可能的重复项
list(REMOVE_DUPLICATES subdirs)

# 输出获取到的文件夹列表
message("Subdirectories: ${subdirs}")
foreach (item IN LISTS subdirs)
    message("${item}")
    # git add LICENSE && git commit -m '添加许可证' && git push && cd ..
    execute_process(COMMAND ${GIT_EXE} add LICENSE WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/../${item})
    execute_process(COMMAND ${GIT_EXE} commit -m "'添加许可证'" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/../${item})
    execute_process(COMMAND ${GIT_EXE} push WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/../${item})

endforeach ()





